package algutil.filter;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.List;

public class ImageFilter implements FileFilter {

	public boolean accept(File pathname) {
		
		// TODO rechercher la liste des extensions disponibles
		//Configuration conf = ConfigurationImpl.getInstance();
		//List<String> extensions = conf.getExtension();
		List<String> extensions = new ArrayList<String>();
		extensions.add(".jpg");
		extensions.add(".JPG");
		extensions.add(".jpeg");
		extensions.add(".JPEG");
		
		
		if (pathname.isDirectory()) {
			return false;
		} else {
			String name = pathname.getName();
			for (int i=0;i<extensions.size();i++) {
				if (name.endsWith((String)extensions.get(i))) {
					return true;
				}
			}
		}
		return false;
	}
}
